import React, { Component } from "react";

import ReactDom from "react";

export default class OnClick extends Component {
    handlerClick1() {
        console.log(this);
        alert('click1')
    }

    handlerClick2 = ()=>{
        console.log(this);

        alert('click2')
    }

    handlerClick3() {
        console.log(this);

        alert('click3')
    }

    render() {
        return (
            <div>
                <h1>react 组件绑定事件</h1>
                <button onClick={()=>this.handlerClick1()}>click1</button>

                <button onClick={this.handlerClick2}>click2</button>

                <button onClick={this.handlerClick3.bind(this)}>click2</button>
            </div>
        )
    }
}